<%--
  Created by IntelliJ IDEA.
  User: 小玄
  Date: 2022.09.05
  Time: 15:20
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@include file="../common.jsp"%>
<html>
<head>
    <title>完成</title>
    <style>
        html,
        body {
            color: pink;
            background: rgba(2, 2, 1, 0.93);
            margin: 0;
            padding: 0;
        }

        canvas {
            width: 100%;
            height: 100%;
            position: absolute;
        }

        .codrops-demos {
            font-size: 0.8em;
            text-align: center;
            position: absolute;
            z-index: 99;
            width: 96%;
        }

        .codrops-demos a {
            display: inline-block;
            margin: 0.35em 0.1em;
            padding: 0.5em 1.2em;
            outline: none;
            text-decoration: none;
            text-transform: uppercase;
            letter-spacing: 1px;
            font-weight: 700;
            border-radius: 2px;
            font-size: 110%;
            border: 2px solid transparent;
            color: #fff;
        }

        .codrops-demos a:hover,
        .codrops-demos a.current-demo {
            border-color: #383a3c;
        }

        /*form表单*/
        .layui-form {
            width: 100%;
            margin: 0;
            padding: 0;
        }

        .container {
            width: 100%;
            height: 700px;
            max-height: 700px;
            position: absolute;
            top: 0;
            left: 0;
            bottom: 0;
            right: 0;
            margin: auto;
            padding: 20px;
            z-index: 130;
            border-radius: 8px;
            background-color: rgba(255, 255, 255, 0.11);
            font-size: 16px;
            border: red;
            overflow: auto;
        }

        .contain {
            bottom: 0;
            right: 0;
            margin: auto;
            padding: 20px;
            z-index: 130;
            border-radius: 8px;
            background-color: rgba(255, 255, 255, 0.11);
            font-size: 16px;
            overflow: hidden;
        }

        .topic {
            text-align: center;
            color: #ffffff;
            font-size: 25px;
            font-weight: normal;
        }

        .my-form-item {
            margin: 25px -50px;
            background-color: rgba(0, 0, 0, 0);
        }

        .my-input {
            border-radius: 45px;
            width: 300px;
            height: 40px;
            font-size: 15px;
            color: white;
            background-color: rgba(255, 255, 255, 0);
            border: rgba(255, 255, 255, 0.2) 2px solid;
            text-align: center;
        }

        .mine-input {
            border-radius: 45px;
            width: 300px;
            height: 40px;
            font-size: 15px;
            border: rgba(0, 0, 0, 0.5) 2px solid;
            text-align: center;
        }

        .layui-btn {
            border-radius: 45px;
            width: 300px;
            height: 40px;
            font-size: 15px;
            color: white;
            background-color: rgba(0, 0, 0, 0);
            border: rgba(255, 255, 255, 0.2) 2px solid;
        }
        .font-set{
            font-size: 13px;
            text-decoration: none;
            margin-left: 100px;
            color: white;
        }

        @media screen and (max-device-width: 600px) {

            .container {
                width: 100%;
                margin-left: 0;
                margin-right: 0;

            }

            .my-form-item {
                margin: 25px -100px;
                background-color: rgba(0, 0, 0, 0);
            }
        }

        #show {
            margin: 0 auto;
            font-family: 华文行楷;
            font-size: 30px;
        }

        #bb {
            width: 200px;
            height: 80px;
            color: pink;
            margin:10px auto;
            line-height: 80px;
        }

    </style>
</head>
<body>

<div class="container">
    <input type="hidden" id="type" name="type" value="${view.type}">
    <input name="testerId" id="testerId" type="hidden" value="${testerId}">

    <div id="show">
        <div id="bb">MHT测试结果</div>
        <div style="width: 80%;height: 600px;color: pink; margin: auto;background-color: rgba(0,0,0,0.2)" id="shopping"></div>
        <div style="width: 100%;margin: auto;" id="explain"></div>
    </div>
</div>

</body>

<script>

    layui.config({
        version: 1,
        base: 'echarts/' //这个就是你放Echart.js的目录
    }).use(['element', 'echarts', 'carousel','form', 'layer', 'jquery'], function () {
        var element = layui.element,
            $ = layui.jquery,
            carousel = layui.carousel,
            echarts = layui.echarts;
        var form = layui.form;
        var layer = layui.layer;
        var $ = layui.jquery;
        console.log( $("#type").val())
        console.log( $("#testerId").val());

        $.ajax({
            url: "${pageContext.request.contextPath}/viewTestResultMht/ViewQueryById.do",
            dataType: "json",
            type: "post",
            data:{
                type: $("#type").val(),
                id:$("#testerId").val()
            },
            success: function (re) {

                var shopping = echarts.init(document.getElementById('shopping'), 'dark');

                var option = {
                    title: {
                        text: 'Mht心理健康测试',
                        subtext: '测试人数：' + (re.data.sumpeople),
                        left: 'left'
                    },
                    tooltip: {},
                    legend: {
                        top: 'bottom',
                        data: ['分数']
                    },
                    toolbox: {
                        show: true,
                        feature: {
                            mark: { show: true },
                            dataView: { show: true, readOnly: false },
                            restore: { show: true },
                            saveAsImage: { show: true }
                        }
                    },
                    //下面是折线图用的
                    xAxis: {
                        type: 'category',
                        data: ['学习焦虑', '对人焦虑', '孤独倾向', '自责倾向', '过敏倾向', '身体症状', '恐怖倾向', '冲动倾向']
                    },
                    yAxis: {
                        type: 'value',
                        gridIndex: 0
                    },
                    grid: {top: '50%'},

                    series: [
                        //基础南丁格尔玫瑰图
                        {
                            name: 'Nightingale Chart',
                            type: 'pie',
                            radius: [50, 200],
                            center: ['50%', '45%'],
                            roseType: 'area',
                            itemStyle: {
                                borderRadius: 8
                            },
                            data: [
                                { value: re.data.studyanxiety, name: '学习焦虑' },
                                { value: re.data.peopleanxiety, name: '对人焦虑' },
                                { value: re.data.feelalone, name: ' 孤独倾向' },
                                { value: re.data.feelremorse, name: ' 自责倾向' },
                                { value: re.data.feelallergic, name: '过敏倾向 ' },
                                { value: re.data.body, name: ' 身体症状' },
                                { value: re.data.feelterror, name: '恐怖倾向 ' },
                                { value: re.data.easyimpulse, name: ' 冲动倾向' }
                            ]
                        }

                    ]
                };

                // 使用刚指定的配置项和数据显示图表。
                shopping.setOption(option);
            }
        })
    });

</script>

</html>
